const Paper = require('../control/paper')


async function testPaperList(req,res){
    const {page,pageSize,username} = req.query;
    let result = await Paper.testPaperList(page,pageSize,username)
    res.send(result);
}

async function createTestPaper(req,res){
    console.log(req.body);
    const {name,description,username} = req.body;
    let result = await Paper.createTestPaper(name, description, username);
    res.send(result);
}
async function deleteTestPaper(req,res){
    const {tp_id,username} = req.body;
    let result = await Paper.deleteTestPaper(tp_id, username);
    res.send(result);
}
async function testPaperDetail(req,res){
    const {tp_id,username} = req.query;
    let result = await Paper.testPaperDetail(tp_id,username);
    res.send(result);
}
async function addTestQuestion(req,res){
    const {tp_id,qt_ids,username} = req.body;
    let result = await Paper.addTestQuestion(tp_id,qt_ids,username);
    res.send(result);
}
async function deleteTestQuestion(req,res){
    const {tp_id,qt_ids,username} = req.body;
    let result = await Paper.removeTestQuestion(tp_id,qt_ids,username);
    res.send(result);
}




module.exports = {
    testPaperList,
    createTestPaper,
    deleteTestPaper,
    testPaperDetail,
    addTestQuestion,
    deleteTestQuestion,


}